package com.lg.startertemplate.utiles;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;

/**
 * author: LG
 * date: 2020-06-09 15:29
 * desc:
 */
public class SqlUtils {


    public static HashSet<String> getColName(ResultSet rs) {
        HashSet<String> colNames = new HashSet<>();
        try {
            int columnCount = rs.getMetaData().getColumnCount();
            for (int i = 1; i <=columnCount; i++) {
                colNames.add(rs.getMetaData().getColumnName(i));
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }

        return colNames;


    }
}
